package es;

import lombok.Data;

/**
 * 超级接口参数:
 *
 * @author huaxin.guo
 */
@Data
public class EsCommonParam {
    //专利基础服务选择:1,专利工作空间服务选择:2,企业&政策等其他服务选择:0 <默认>
    private int cluster = 0;
    //索引名(必须填)
    private String index;
    //查询类别:0->检索 1->聚合 2->检索+聚合
    private int queryType;
    //结构体,不给参数默认走match_all
    private String struct;

    //"?preference=_primary_first"
    private String pathParam;

    private Boolean ifCache = Boolean.TRUE;

    private int env=1;

    public EsCommonParam() {
    }

    public EsCommonParam(String index, int queryType, String struct) {
        this.index = index;
        this.queryType = queryType;
        this.struct = struct;
    }

    public EsCommonParam(String index, int queryType, String struct, int env) {
        this.index = index;
        this.queryType = queryType;
        this.struct = struct;
        this.env = env;
    }

    public EsCommonParam(int cluster, String index, int queryType, String struct, int env) {
        this(index, queryType, struct, env);
        this.cluster = cluster;
    }

    public EsCommonParam(String index, int queryType, String struct, String pathParam) {
        this.index = index;
        this.queryType = queryType;
        this.struct = struct;
        this.pathParam = pathParam;
    }

    public EsCommonParam(String index, int queryType, String struct, String pathParam, int env) {
        this.index = index;
        this.queryType = queryType;
        this.struct = struct;
        this.pathParam = pathParam;
        this.env = env;
    }

    public EsCommonParam(int cluster, String index, int queryType, String struct, String pathParam, int env) {
        this(index, queryType, struct, pathParam, env);
        this.cluster = cluster;
    }

    public EsCommonParam(String index, int queryType, String struct, String pathParam, int env, Boolean ifCache) {
        this.index = index;
        this.queryType = queryType;
        this.struct = struct;
        this.pathParam = pathParam;
        this.env = env;
        this.ifCache = ifCache;
    }

    public EsCommonParam(int cluster, String index, int queryType, String struct, String pathParam, int env, Boolean ifCache) {
        this.cluster = cluster;
        this.index = index;
        this.queryType = queryType;
        this.struct = struct;
        this.pathParam = pathParam;
        this.env = env;
        this.ifCache = ifCache;
    }

    /*private Token token;

    @Getter
    @Setter
    public static class Token {
        private  String appKey = "";
        private  String publicKey = "";
        private  String token = "";
    }*/
}
